using System.Reflection;
using System.Collections.Generic;
using System.Linq;

namespace Classes.Bases
{
	/// <summary>
	/// Defines de members inherited by all Factory objects.
	/// </summary>
	/// <remarks>No base members at the time of this documentation.</remarks>
	public abstract class Factory
	{
        public static void CopyCreatedUpdatedFields(ProjectCommon2.Interfaces.ICustomEntity toEntity, ProjectCommon2.Interfaces.ICustomEntity fromEntity)
        {
            List<MemberInfo> fromList = new List<MemberInfo>(fromEntity.GetType().GetMembers());
            List<MemberInfo> toList = new List<MemberInfo>(toEntity.GetType().GetMembers());

            PropertyInfo createdAtTo = (PropertyInfo)toList.Find(d => d.Name.Equals("CreatedAt"));
            PropertyInfo createdAtFrom = (PropertyInfo)fromList.Find(d => d.Name.Equals("CreatedAt"));

            if (createdAtTo.GetValue(toEntity, null) == null)
                createdAtTo.SetValue(toEntity, createdAtFrom.GetValue(fromEntity, null), null);

            PropertyInfo createdByTo = (PropertyInfo)toList.Find(d => d.Name.Equals("CreatedBy"));
            PropertyInfo createdByFrom = (PropertyInfo)fromList.Find(d => d.Name.Equals("CreatedBy"));

            if (createdByTo.GetValue(toEntity, null) == null)
                createdByTo.SetValue(toEntity, createdByFrom.GetValue(fromEntity, null), null);

            PropertyInfo createdOnTo = (PropertyInfo)toList.Find(d => d.Name.Equals("CreatedOn"));
            PropertyInfo createdOnFrom = (PropertyInfo)fromList.Find(d => d.Name.Equals("CreatedOn"));

            if (createdOnTo.GetValue(toEntity, null) == null)
                createdOnTo.SetValue(toEntity, createdOnFrom.GetValue(fromEntity, null), null);

            PropertyInfo updatedOnTo = (PropertyInfo)toList.Find(d => d.Name.Equals("UpdatedOn"));
            PropertyInfo updatesOnFrom = (PropertyInfo)fromList.Find(d => d.Name.Equals("UpdatedOn"));
            updatedOnTo.SetValue(toEntity, updatesOnFrom.GetValue(fromEntity, null), null);

            PropertyInfo updatedAtTo = (PropertyInfo)toList.Find(d => d.Name.Equals("UpdatedAt"));
            PropertyInfo updatesAtFrom = (PropertyInfo)fromList.Find(d => d.Name.Equals("UpdatedAt"));
            updatedAtTo.SetValue(toEntity, updatesAtFrom.GetValue(fromEntity, null), null);

            PropertyInfo updatedByTo = (PropertyInfo)toList.Find(d => d.Name.Equals("UpdatedBy"));
            PropertyInfo updatesByFrom = (PropertyInfo)fromList.Find(d => d.Name.Equals("UpdatedBy"));
            updatedByTo.SetValue(toEntity, updatesByFrom.GetValue(fromEntity, null), null);
        } 
	}
	
	#region Event Argument definitions

	/// <summary>
    /// Holds the data that is sent when the OnBeforeSaveEntityBegin event is raised.
	/// </summary>
	/// <remarks>Allows a Factory object to interchange messages and data with other objects before saving an Entity to the database.
    /// For more information, look at how the <c>Save()</c> method works for any of the Factories.
    /// </remarks>
	public class BeforeSaveEntityBeginEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the boolean value that specifies if a Save process is cancelled or continued.
        /// </summary>
        private bool prop_CancelContinue;
		
		/// <summary>
        /// Gets or Sets a value that determines whether the Factory will cancel or continue the Save process.
		/// <para>Use <c>true</c> to stop processing, <c>false</c> to continue.</para>
        /// </summary>
		/// <value>Stops the save process if set to <c>true</c>. Stored in <see cref="prop_CancelContinue" />. 
		/// </value>
        public bool CancelContinue
        {
            get { return prop_CancelContinue; }
            set { prop_CancelContinue = value; }
        }
	
        /// <summary>
        /// Stores the boolean value that specifies if a transaction should be started.
        /// </summary>
        private bool prop_BeginTransaction;
		
		/// <summary>
        /// Gets or Sets a value that determines if the Factory method that fired the event should
		/// start a new SQL transaction.
		/// <para>Use <c>true</c> to start a new transaction, <c>false</c> otherwise.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_BeginTransaction" />. If <c>true</c>, then a new SQL
		/// transaction is started when the Save process resumes.</value>
        public bool BeginTransaction
        {
            get { return prop_BeginTransaction; }
            set { prop_BeginTransaction = value; }
        }

        /// <summary>
        /// Stores the Entity object to be saved.
        /// </summary>
        private object prop_EntityToSave;
		
		/// <summary>
        /// Gets or Sets the Entity object that the Factory will attempt to save.
        /// </summary>
		/// <value>Entity stored as an <see cref="System.Object" /> in <see cref="prop_EntityToSave" /> that serves as an
		/// argument to the Factory's <c>Save()</c> method.
		/// </value>
        public object EntityToSave
        {
            get { return prop_EntityToSave; }
            set { prop_EntityToSave = value; }
        }
	
        /// <summary>
        /// Stores the value that specifies if the checksum will be verified when saving an Entity.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determines if the Factory should apply checksum verification when
		/// attempting to save the Entity.
		/// <para>Use <c>true</c> to verify the checksums, <c>false</c> to ignore them.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>Save()</c> method will verify the checksums when saving the Entity to the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }
	
	}
	
	/// <summary>
    /// Holds the data that is sent when the OnBeforeSaveEntityCommit event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects before comitting a Save operation to the database.
    /// For more information, look at how the <c>Save()</c> method works for any of the Factories.
    /// </remarks>
	public class BeforeSaveEntityCommitEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity object to be saved.
        /// </summary>
        private object prop_EntityToSave;
		
		/// <summary>
        /// Gets or Sets the Entity object that the Factory will attempt to commit to the database.
        /// </summary>
		/// <value>Required argument for the Factory's <c>Save()</c> method. It is an Entity stored in <see cref="prop_EntityToSave" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToSave
        {
            get { return prop_EntityToSave; }
            set { prop_EntityToSave = value; }
        }
		
		/// <summary>
        /// Stores the value that specifies if checksum verification was applied when saving an Entity.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determined if the Factory applied checksum verification 
		/// during the Save operation.
		/// <para><c>True</c> verifies the checksums, <c>false</c> ignores them.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, the Factory's
		/// <c>Save()</c> method verified the checksums when saving the Entity to the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }
	}

	/// <summary>
    /// Holds the data that is sent when the OnBeforeSaveCollectionBegin event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects before saving a collection of Entities
    /// to the database. For more information, look at how the <c>Save()</c> method works for any of the Factories.
    /// </remarks>
	public class BeforeSaveCollectionBeginEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the boolean value that specifies if a Save process is cancelled or continued.
        /// </summary>
        private bool prop_CancelContinue;
		
		/// <summary>
        /// Gets or Sets a value that determines whether the Factory will cancel or continue the Save process.
		/// <para>Use <c>true</c> to stop processing, <c>false</c> to continue.</para>
        /// </summary>
		/// <value>Stops processing if set to <c>true</c>. Stored in <see cref="prop_CancelContinue" />. 
		/// </value>
        public bool CancelContinue
        {
            get { return prop_CancelContinue; }
            set { prop_CancelContinue = value; }
        }

        /// <summary>
        /// Stores the boolean value that specifies if a transaction should be started.
        /// </summary>
        private bool prop_BeginTransaction;
		
		/// <summary>
        /// Gets or Sets a value that determines if the Factory method that fired the event should
		/// start a new SQL transaction.
		/// <para>Use <c>true</c> to start a new transaction, <c>false</c> otherwise.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_BeginTransaction" />. If <c>true</c>, then a new SQL
		/// transaction is started when the Save process resumes.</value>
        public bool BeginTransaction
        {
            get { return prop_BeginTransaction; }
            set { prop_BeginTransaction = value; }
        }
	
        /// <summary>
        /// Stores the Entity collection to be saved.
        /// </summary>
        private object prop_CollectionToSave;
		
		/// <summary>
        /// Gets or Sets the Entity collection that the Factory will attempt to save.
        /// </summary>
		/// <value>Entity stored as an <see cref="System.Object" /> in <see cref="prop_CollectionToSave" /> that serves as an
		/// argument to the Factory's <c>Save()</c> method.
		/// </value>
        public object CollectionToSave
        {
            get { return prop_CollectionToSave; }
            set { prop_CollectionToSave = value; }
        }
	
        /// <summary>
        /// Stores the value that specifies if the checksum will be verified when saving an Entity collection.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determines if the Factory should apply checksum verification when
		/// attempting to save each Entity in the collection.
		/// <para>Use <c>true</c> to verify the checksums, <c>false</c> to ignore them.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>Save()</c> method will verify the checksums when saving Entities to the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }
	}

	/// <summary>
    /// Holds the data that is sent when the OnBeforeSaveCollectionCommit event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects before comitting the Save operation for
    /// a collection of Entities to the database. For more information, look at how the <c>Save()</c> method works for any of the Factories.
    /// </remarks>
	public class BeforeSaveCollectionCommitEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity collection to be saved.
        /// </summary>
        private object prop_CollectionToSave;
		
		/// <summary>
        /// Gets or Sets the Entity collection that the Factory will attempt to commit to the database.
        /// </summary>
		/// <value>Required argument for the Factory's <c>Save()</c> method. It is an <see cref="ProjectCommon.Generics.EntityCollection&lt;EntityType&gt;" /> stored in
		/// <see cref="prop_CollectionToSave" /> as an <see cref="System.Object" />.
		/// </value>
        public object CollectionToSave
        {
            get { return prop_CollectionToSave; }
            set { prop_CollectionToSave = value; }
        }
		
		/// <summary>
        /// Stores the value that specifies if checksums were verified when saving an Entity collection.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determined if the Factory applied checksum verification 
		/// during the Save operation.
		/// <para><c>True</c> verifies the checksums, <c>false</c> ignores them.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, the Factory's
		/// <c>Save()</c> method verified the checksums when saving the Entity to the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }
	}
	
	/// <summary>
    /// Holds the data that is sent when the OnBeforeGetEntity event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects before retrieving an Entity
    /// from the database. For more information, look at how the <c>GetEntity()</c> method works for any of the Factories.
    /// </remarks>
	public class BeforeGetEntityEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity used to filter the results of a query.
        /// </summary>
        private object prop_EntityToFilterWith;
		
		/// <summary>
		/// Gets or Sets the Entity whose column properties are used as parameters to a query.
		/// </summary>
		/// <value>Required parameter to the <c>GetEntity()</c> method. It is an Entity stored in <see cref="prop_EntityToFilterWith" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToFilterWith
        {
            get { return prop_EntityToFilterWith; }
            set { prop_EntityToFilterWith = value; }
        }

        /// <summary>
        /// Stores the value that specifies if the checksum will be verified when retrieving an Entity.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determines if the Factory should verify that the retrieved Entity's checksum is correct.
		/// <para>Use <c>true</c> to verify the checksum, <c>false</c> to ignore it.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>GetEntity()</c> method will verify the checksum when loading the Entity from the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }
        
        /// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory will execute.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }
	}
	
	/// <summary>
    /// Holds the data that is sent when the OnBeforeGetEntityCollection event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects before retrieving a collection of Entities
    /// from the database. For more information, look at how the <c>GetCollection()</c> method works for any of the Factories.
    /// </remarks>
	public class BeforeGetEntityCollectionEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity used to filter the results of a query.
        /// </summary>
        private object prop_EntityToFilterWith;
		
		/// <summary>
		/// Gets or Sets the Entity whose column properties are used as parameters to a query.
		/// </summary>
		/// <value>Required parameter to the <c>GetEntityCollection()</c> method. Entity stored in <see cref="prop_EntityToFilterWith" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToFilterWith
        {
            get { return prop_EntityToFilterWith; }
            set { prop_EntityToFilterWith = value; }
        }

        /// <summary>
        /// Stores the value that specifies if checksums will be verified when retrieving a collection of Entities.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determines if the Factory should verify that the retrieved Entities' checksums are correct.
		/// <para>Use <c>true</c> to verify the checksums, <c>false</c> to ignore them.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>GetEntityCollection()</c> method will verify the checksums when loading the Entities from the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }

        /// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory will execute.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }
	}
	
	/// <summary>
    /// Holds the data that is sent when the OnBeforeEntityInsert event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects before inserting an Entity's record
    /// in the database. For more information, look at how the <c>Insert()</c> method works for any of the Factories.
    /// </remarks>
	public class BeforeEntityInsertEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity to be inserted in the database.
        /// </summary>
        private object prop_EntityToInsert;
		
		/// <summary>
		/// Gets or Sets the Entity to insert as a new record in the database.
		/// </summary>
		/// <value>Required parameter to the <c>Insert()</c> method. It is an Entity stored in <see cref="prop_EntityToInsert" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToInsert
        {
            get { return prop_EntityToInsert; }
            set { prop_EntityToInsert = value; }
        }
	
		/// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory will execute.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }
	}
	
	/// <summary>
    /// Holds the data that is sent when the OnBeforeEntityUpdate event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects before updating an Entity's record
    /// in the database. For more information, look at how the <c>Update()</c> method works for any of the Factories.
    /// </remarks>
	public class BeforeEntityUpdateEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity to be updated in the database.
        /// </summary>
        private object prop_EntityToUpdate;
		
		/// <summary>
		/// Gets or Sets the Entity whose database record will be updated by the Factory.
		/// </summary>
		/// <value>Required parameter to the <c>Update()</c> method. It is an Entity stored in <see cref="prop_EntityToUpdate" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToUpdate
        {
            get { return prop_EntityToUpdate; }
            set { prop_EntityToUpdate = value; }
        }	

        /// <summary>
        /// Stores the value that specifies if the checksum will be verified when updating an Entity.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determines if the Factory should verify that the database checksum is correct after
		/// updating the Entity.
		/// <para>Use <c>true</c> to verify the checksum, <c>false</c> to ignore it.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>Update()</c> method will verify the checksum when reloading the Entity from the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }

        /// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory will execute.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }

	}
	
	/// <summary>
    /// Holds the data that is sent when the OnBeforeEntityDelete event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects before deleting an Entity's record
    /// from the database. For more information, look at how the <c>Delete()</c> method works for any of the Factories.
    /// </remarks>
	public class BeforeEntityDeleteEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity to be deleted from the database.
        /// </summary>
        private object prop_EntityToDelete;
		
		/// <summary>
		/// Gets or Sets the Entity whose database record will be deleted by the Factory.
		/// </summary>
		/// <value>Required parameter to the <c>Delete()</c> method. It is an Entity stored in <see cref="prop_EntityToDelete" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToDelete
        {
            get { return prop_EntityToDelete; }
            set { prop_EntityToDelete = value; }
        }
	
        /// <summary>
        /// Stores a value that specifies if the checksum will be used when deleting an Entity.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determines if the Factory should use the checksum to verify that the correct
		/// Entity is being deleted.
		/// <para>Use <c>true</c> to verify the checksum, <c>false</c> to ignore it.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>Delete()</c> method will verify the checksum when deleting the Entity from the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }

        /// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory will execute.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }
	}
	
	/// <summary>
    /// Holds the data that is sent when the OnAfterGetEntity event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects after retrieving an Entity
    /// from the database. For more information, look at how the <c>GetEntity()</c> method works for any of the Factories.
    /// </remarks>
	public class AfterGetEntityEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity used to filter the results of a query.
        /// </summary>
        private object prop_EntityToFilterWith;
		
		/// <summary>
		/// Gets or Sets the Entity whose column properties were used as parameters to a query.
		/// </summary>
		/// <value>Required parameter to the <c>GetEntity()</c> method. It is an Entity stored in <see cref="prop_EntityToFilterWith" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToFilterWith
        {
            get { return prop_EntityToFilterWith; }
            set { prop_EntityToFilterWith = value; }
        }
	
        /// <summary>
        /// Stores the Entity to be returned to a calling method.
        /// </summary>
        private object prop_EntityToReturn;
		
		/// <summary>
		/// Gets or Sets the Entity that will be returned by the Factory's <c>GetEntity()</c> method.
		/// </summary>
		/// <value>Entity object resulting from a call to the <c>GetEntity()</c> method. Stored in
		/// <see cref="prop_EntityToReturn" /> as an <see cref="System.Object" />.
		/// </value>
        public object EntityToReturn
        {
            get { return prop_EntityToReturn; }
            set { prop_EntityToReturn = value; }
        }	

        /// <summary>
        /// Stores the value that specifies if the checksum was verified when retrieving an Entity.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determined if the Factory verified that the retrieved Entity's checksum were correct.
		/// <para><c>True</c> verifies the checksum, <c>false</c> ignores it.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>GetEntity()</c> method verified the checksum when loading the Entity from the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }

        /// <summary>
        /// Stores the <c>DataSet</c> resulting from running a query against the database.
        /// </summary>
        private System.Data.DataSet prop_DataSetFromDataBase;
		
		/// <summary>
		/// Gets or Sets the <c>DataSet</c> that was returned to the Factory's <c>GetEntity()</c> method as a result of
		/// executing its SQL command.
		/// </summary>
		/// <value>The result set from a query to the database. Stored in
		/// <see cref="prop_DataSetFromDataBase" />.
		/// </value>
        public System.Data.DataSet DataSetFromDataBase
        {
            get { return prop_DataSetFromDataBase; }
            set { prop_DataSetFromDataBase = value; }
        }

        /// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory executed.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }
	}
	
	/// <summary>
    /// Holds the data that is sent when the OnAfterGetEntityCollection event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects after retrieving a collection of Entities
    /// from the database. For more information, look at how the <c>GetCollection()</c> method works for any of the Factories.
    /// </remarks>
	public class AfterGetEntityCollectionEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity used to filter the results of a query.
        /// </summary>
        private object prop_EntityToFilterWith;
		
		/// <summary>
		/// Gets or Sets the Entity whose column properties were used as parameters to a query.
		/// </summary>
		/// <value>Required parameter to the <c>GetEntityCollection()</c> method. It is an Entity stored in
		/// <see cref="prop_EntityToFilterWith" /> as an <see cref="System.Object" />.
		/// </value>
        public object EntityToFilterWith
        {
            get { return prop_EntityToFilterWith; }
            set { prop_EntityToFilterWith = value; }
        }
	
        /// <summary>
        /// Stores the Entity collection to be returned to a calling method.
        /// </summary>
        private object prop_CollectionToReturn;
		
		/// <summary>
		/// Gets or Sets the Entity collection that will be returned by the Factory's <c>GetEntity()</c> method.
		/// </summary>
		/// <value>Object resulting from a call to the <c>GetEntityCollection()</c> method. It is an
		/// <see cref="ProjectCommon.Generics.EntityCollection&lt;EntityType&gt;" /> stored in <see cref="prop_CollectionToReturn" />
		/// as an <see cref="System.Object" />.
		/// </value>        
        public object CollectionToReturn
        {
            get { return prop_CollectionToReturn; }
            set { prop_CollectionToReturn = value; }
        }
	
        /// <summary>
        /// Stores the value that specifies if the checksum was verified when retrieving each Entity in a collection.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determined if the Factory verified that the retrieved Entities' checksums were correct.
		/// <para><c>True</c> verifies the checksums, <c>false</c> ignores them.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>GetEntityCollection()</c> method verified the checksum when loading each Entity from the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }

        /// <summary>
        /// Stores the <c>DataSet</c> resulting from running a query against the database.
        /// </summary>
        private System.Data.DataSet prop_DataSetFromDataBase;
		
		/// <summary>
		/// Gets or Sets the <c>DataSet</c> that was returned to the Factory's <c>GetEntityCollection()</c> method as a result of
		/// executing its SQL command.
		/// </summary>
		/// <value>The result set from a query to the database. Stored in
		/// <see cref="prop_DataSetFromDataBase" />.
		/// </value>
        public System.Data.DataSet DataSetFromDataBase
        {
            get { return prop_DataSetFromDataBase; }
            set { prop_DataSetFromDataBase = value; }
        }

        /// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory executed.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }

	}
	
	/// <summary>
    /// Holds the data that is sent when the OnAfterEntityInsert event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects after inserting an Entity's record
    /// in the database. For more information, look at how the <c>Insert()</c> method works for any of the Factories.
    /// </remarks>
	public class AfterEntityInsertEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity that was inserted to the database.
        /// </summary>
        private object prop_EntityToInsert;
		
		/// <summary>
		/// Gets or Sets the Entity for which the Factory inserted a new record in the database.
		/// </summary>
		/// <value>Required parameter to the <c>Insert()</c> method. It is an Entity stored in <see cref="prop_EntityToInsert" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToInsert
        {
            get { return prop_EntityToInsert; }
            set { prop_EntityToInsert = value; }
        }
	
        /// <summary>
        /// Stores the <c>DataSet</c> resulting from running a query against the database.
        /// </summary>
        private System.Data.DataSet prop_DataSetFromDataBase;
		
		/// <summary>
		/// Gets or Sets the <c>DataSet</c> that was returned to the Factory's <c>Insert()</c> method as a result of
		/// executing its SQL command.
		/// </summary>
		/// <value>The result set from a query to the database. Stored in
		/// <see cref="prop_DataSetFromDataBase" />.
		/// </value>
        public System.Data.DataSet DataSetFromDataBase
        {
            get { return prop_DataSetFromDataBase; }
            set { prop_DataSetFromDataBase = value; }
        }

        /// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory executed.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }
	}
	
	/// <summary>
    /// Holds the data that is sent when the OnAfterEntityUpdate event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects after updating an Entity's record
    /// in the database. For more information, look at how the <c>Update()</c> method works for any of the Factories.
    /// </remarks>
	public class AfterEntityUpdateEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity whose database record was updated.
        /// </summary>
        private object prop_EntityToUpdate;
		
		/// <summary>
		/// Gets or Sets the Entity whose database record was updated by the Factory.
		/// </summary>
		/// <value>Required parameter to the <c>Update()</c> method. It is an Entity stored in <see cref="prop_EntityToUpdate" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToUpdate
        {
            get { return prop_EntityToUpdate; }
            set { prop_EntityToUpdate = value; }
        }	

        /// <summary>
        /// Stores the value that specifies if the checksum was verified when updating an Entity.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determined if the Factory verified that a record's checksum was correct
		/// after updating it.
		/// <para><c>True</c> verifies the checksum, <c>false</c> ignores it.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>Update()</c> method verified the checksum when reloading the Entity from the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }

        /// <summary>
        /// Stores the <c>DataSet</c> resulting from running a query against the database.
        /// </summary>
        private System.Data.DataSet prop_DataSetFromDataBase;
		
		/// <summary>
		/// Gets or Sets the <c>DataSet</c> that was returned to the Factory's <c>Update()</c> method as a result of
		/// executing its SQL command.
		/// </summary>
		/// <value>The result set from a query to the database. Stored in
		/// <see cref="prop_DataSetFromDataBase" />.
		/// </value>
        public System.Data.DataSet DataSetFromDataBase
        {
            get { return prop_DataSetFromDataBase; }
            set { prop_DataSetFromDataBase = value; }
        }

        /// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory executed.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }

	}
	
	/// <summary>
    /// Holds the data that is sent when the OnAfterEntityDelete event is raised.
	/// </summary>
    /// <remarks>Allows a Factory object to interchange messages and data with other objects after deleting an Entity's record
    /// from the database. For more information, look at how the <c>Delete()</c> method works for any of the Factories.
    /// </remarks>
	public class AfterEntityDeleteEventArgs : System.EventArgs
	{
        /// <summary>
        /// Stores the Entity whose record was deleted from the database.
        /// </summary>
        private object prop_EntityToDelete;
		
		/// <summary>
		/// Gets or Sets the Entity whose database record was deleted by the Factory.
		/// </summary>
		/// <value>Required parameter to the <c>Delete()</c> method. It is an Entity stored in <see cref="prop_EntityToDelete" />
		/// as an <see cref="System.Object" />.
		/// </value>
        public object EntityToDelete
        {
            get { return prop_EntityToDelete; }
            set { prop_EntityToDelete = value; }
        }	

        /// <summary>
        /// Stores a value that specifies if the checksum was used when deleting an Entity.
        /// </summary>
        private bool prop_UseCheckSum;
		
		/// <summary>
        /// Gets or Sets the value that determined if the Factory used the checksum to verify that the correct
		/// Entity was being deleted.
		/// <para><c>True</c> verifies the checksum, <c>false</c> ignores it.</para>
        /// </summary>
		/// <value>Stored in <see cref="prop_UseCheckSum" />. If <c>true</c>, then the Factory's
		/// <c>Delete()</c> method verified the checksum when deleting the Entity from the database.</value>
        public bool UseCheckSum
        {
            get { return prop_UseCheckSum; }
            set { prop_UseCheckSum = value; }
        }

        /// <summary>
        /// Stores the SQL command used to perform a query.
        /// </summary>
        private System.Data.SqlClient.SqlCommand prop_SqlCommandToExecute;
		
		/// <summary>
		/// Gets or Sets the SQL command that the Factory executed.
		/// </summary>
		/// <value>Object that represents a SQL Server command; stored in <see cref="prop_SqlCommandToExecute" />
		/// as an <see cref="System.Data.SqlClient.SqlCommand" /> object.
		/// </value>
        public System.Data.SqlClient.SqlCommand SqlCommandToExecute
        {
            get { return prop_SqlCommandToExecute; }
            set { prop_SqlCommandToExecute = value; }
        }
	}
	
	#endregion

}